home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 2003 August / MW 8 2003 CD1.iso / Inside Macworld / Product News / gimp-1.2.4.sit / gimp-1.2.4 / libgimp / gimpdrawable_pdb.c < prev    next >
Encoding:
C/C++ Source or Header  |  2002-12-16  |  17.9 KB  |  710 lines

  1. /* LIBGIMP - The GIMP Library
  2.  * Copyright (C) 1995-2000 Peter Mattis and Spencer Kimball
  3.  *
  4.  * gimpdrawable_pdb.c
  5.  *
  6.  * This library is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2 of the License, or (at your option) any later version.
  10.  *
  11.  * This library is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with this library; if not, write to the
  18.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19.  * Boston, MA 02111-1307, USA.
  20.  */
  21.  
  22. /* NOTE: This file is autogenerated by pdbgen.pl */
  23.  
  24. #include <string.h>
  25.  
  26. #include "gimp.h"
  27.  
  28. /**
  29.  * gimp_drawable_merge_shadow:
  30.  * @drawable_ID: The drawable.
  31.  * @undo: Push merge to undo stack?
  32.  *
  33.  * Merge the shadow buffer with the specified drawable.
  34.  *
  35.  * This procedure combines the contents of the image's shadow buffer
  36.  * (for temporary processing) with the specified drawable. The \"undo\"
  37.  * parameter specifies whether to add an undo step for the operation.
  38.  * Requesting no undo is useful for such applications as 'auto-apply'.
  39.  *
  40.  * Returns: TRUE on success.
  41.  */
  42. gboolean
  43. gimp_drawable_merge_shadow (gint32   drawable_ID,
  44.                 gboolean undo)
  45. {
  46.   GimpParam *return_vals;
  47.   gint nreturn_vals;
  48.   gboolean success = TRUE;
  49.  
  50.   return_vals = gimp_run_procedure ("gimp_drawable_merge_shadow",
  51.                     &nreturn_vals,
  52.                     GIMP_PDB_DRAWABLE, drawable_ID,
  53.                     GIMP_PDB_INT32, undo,
  54.                     GIMP_PDB_END);
  55.  
  56.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  57.  
  58.   gimp_destroy_params (return_vals, nreturn_vals);
  59.  
  60.   return success;
  61. }
  62.  
  63. /**
  64.  * gimp_drawable_fill:
  65.  * @drawable_ID: The drawable.
  66.  * @fill_type: The type of fill.
  67.  *
  68.  * Fill the drawable with the specified fill mode.
  69.  *
  70.  * This procedure fills the drawable with the fill mode. If the fill
  71.  * mode is foreground the current foreground color is used. If the fill
  72.  * mode is background, the current background color is used. If the
  73.  * fill type is white, then white is used. Transparent fill only
  74.  * affects layers with an alpha channel, in which case the alpha
  75.  * channel is set to transparent. If the drawable has no alpha channel,
  76.  * it is filled to white. No fill leaves the drawable's contents
  77.  * undefined. This procedure is unlike the bucket fill tool because it
  78.  * fills regardless of a selection
  79.  *
  80.  * Returns: TRUE on success.
  81.  */
  82. gboolean
  83. gimp_drawable_fill (gint32       drawable_ID,
  84.             GimpFillType fill_type)
  85. {
  86.   GimpParam *return_vals;
  87.   gint nreturn_vals;
  88.   gboolean success = TRUE;
  89.  
  90.   return_vals = gimp_run_procedure ("gimp_drawable_fill",
  91.                     &nreturn_vals,
  92.                     GIMP_PDB_DRAWABLE, drawable_ID,
  93.                     GIMP_PDB_INT32, fill_type,
  94.                     GIMP_PDB_END);
  95.  
  96.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  97.  
  98.   gimp_destroy_params (return_vals, nreturn_vals);
  99.  
  100.   return success;
  101. }
  102.  
  103. /**
  104.  * gimp_drawable_update:
  105.  * @drawable_ID: The drawable.
  106.  * @x: x coordinate of upper left corner of update region.
  107.  * @y: y coordinate of upper left corner of update region.
  108.  * @width: Width of update region.
  109.  * @height: Height of update region.
  110.  *
  111.  * Update the specified region of the drawable.
  112.  *
  113.  * This procedure updates the specified region of the drawable. The (x,
  114.  * y) coordinate pair is relative to the drawable's origin, not to the
  115.  * image origin. Therefore, the entire drawable can be updated with:
  116.  * {x->0, y->0, w->width, h->height }.
  117.  *
  118.  * Returns: TRUE on success.
  119.  */
  120. gboolean
  121. gimp_drawable_update (gint32 drawable_ID,
  122.               gint   x,
  123.               gint   y,
  124.               gint   width,
  125.               gint   height)
  126. {
  127.   GimpParam *return_vals;
  128.   gint nreturn_vals;
  129.   gboolean success = TRUE;
  130.  
  131.   return_vals = gimp_run_procedure ("gimp_drawable_update",
  132.                     &nreturn_vals,
  133.                     GIMP_PDB_DRAWABLE, drawable_ID,
  134.                     GIMP_PDB_INT32, x,
  135.                     GIMP_PDB_INT32, y,
  136.                     GIMP_PDB_INT32, width,
  137.                     GIMP_PDB_INT32, height,
  138.                     GIMP_PDB_END);
  139.  
  140.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  141.  
  142.   gimp_destroy_params (return_vals, nreturn_vals);
  143.  
  144.   return success;
  145. }
  146.  
  147. /**
  148.  * gimp_drawable_mask_bounds:
  149.  * @drawable_ID: The drawable.
  150.  * @x1: x coordinate of the upper left corner of selection bounds.
  151.  * @y1: y coordinate of the upper left corner of selection bounds.
  152.  * @x2: x coordinate of the lower right corner of selection bounds.
  153.  * @y2: y coordinate of the lower right corner of selection bounds.
  154.  *
  155.  * Find the bounding box of the current selection in relation to the
  156.  * specified drawable.
  157.  *
  158.  * This procedure returns the whether there is a selection. If there is
  159.  * one, the upper left and lower righthand corners of its bounding box
  160.  * are returned. These coordinates are specified relative to the
  161.  * drawable's origin, and bounded by the drawable's extents. Please
  162.  * note that the pixel specified by the lower righthand coordinate of
  163.  * the bounding box is not part of the selection. The selection ends at
  164.  * the upper left corner of this pixel. This means the width of the
  165.  * selection can be calculated as (x2 - x1), its height as (y2 - y1).
  166.  *
  167.  * Returns: TRUE if there is a selection.
  168.  */
  169. gboolean
  170. gimp_drawable_mask_bounds (gint32  drawable_ID,
  171.                gint   *x1,
  172.                gint   *y1,
  173.                gint   *x2,
  174.                gint   *y2)
  175. {
  176.   GimpParam *return_vals;
  177.   gint nreturn_vals;
  178.   gboolean non_empty = FALSE;
  179.  
  180.   return_vals = gimp_run_procedure ("gimp_drawable_mask_bounds",
  181.                     &nreturn_vals,
  182.                     GIMP_PDB_DRAWABLE, drawable_ID,
  183.                     GIMP_PDB_END);
  184.  
  185.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  186.     {
  187.       non_empty = return_vals[1].data.d_int32;
  188.       *x1 = return_vals[2].data.d_int32;
  189.       *y1 = return_vals[3].data.d_int32;
  190.       *x2 = return_vals[4].data.d_int32;
  191.       *y2 = return_vals[5].data.d_int32;
  192.     }
  193.  
  194.   gimp_destroy_params (return_vals, nreturn_vals);
  195.  
  196.   return non_empty;
  197. }
  198.  
  199. /**
  200.  * gimp_drawable_image:
  201.  * @drawable_ID: The drawable.
  202.  *
  203.  * Returns the drawable's image.
  204.  *
  205.  * This procedure returns the drawable's image.
  206.  *
  207.  * Returns: The drawable's image.
  208.  */
  209. gint32
  210. gimp_drawable_image (gint32 drawable_ID)
  211. {
  212.   GimpParam *return_vals;
  213.   gint nreturn_vals;
  214.   gint32 image_ID = -1;
  215.  
  216.   return_vals = gimp_run_procedure ("gimp_drawable_image",
  217.                     &nreturn_vals,
  218.                     GIMP_PDB_DRAWABLE, drawable_ID,
  219.                     GIMP_PDB_END);
  220.  
  221.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  222.     image_ID = return_vals[1].data.d_image;
  223.  
  224.   gimp_destroy_params (return_vals, nreturn_vals);
  225.  
  226.   return image_ID;
  227. }
  228.  
  229. /**
  230.  * gimp_drawable_type:
  231.  * @drawable_ID: The drawable.
  232.  *
  233.  * Returns the drawable's type.
  234.  *
  235.  * This procedure returns the drawable's type.
  236.  *
  237.  * Returns: The drawable's type.
  238.  */
  239. GimpImageType
  240. gimp_drawable_type (gint32 drawable_ID)
  241. {
  242.   GimpParam *return_vals;
  243.   gint nreturn_vals;
  244.   GimpImageType type = 0;
  245.  
  246.   return_vals = gimp_run_procedure ("gimp_drawable_type",
  247.                     &nreturn_vals,
  248.                     GIMP_PDB_DRAWABLE, drawable_ID,
  249.                     GIMP_PDB_END);
  250.  
  251.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  252.     type = return_vals[1].data.d_int32;
  253.  
  254.   gimp_destroy_params (return_vals, nreturn_vals);
  255.  
  256.   return type;
  257. }
  258.  
  259. /**
  260.  * gimp_drawable_has_alpha:
  261.  * @drawable_ID: The drawable.
  262.  *
  263.  * Returns non-zero if the drawable has an alpha channel.
  264.  *
  265.  * This procedure returns whether the specified drawable has an alpha
  266.  * channel. This can only be true for layers, and the associated type
  267.  * will be one of: { RGBA , GRAYA, INDEXEDA }.
  268.  *
  269.  * Returns: Does the drawable have an alpha channel?
  270.  */
  271. gboolean
  272. gimp_drawable_has_alpha (gint32 drawable_ID)
  273. {
  274.   GimpParam *return_vals;
  275.   gint nreturn_vals;
  276.   gboolean has_alpha = FALSE;
  277.  
  278.   return_vals = gimp_run_procedure ("gimp_drawable_has_alpha",
  279.                     &nreturn_vals,
  280.                     GIMP_PDB_DRAWABLE, drawable_ID,
  281.                     GIMP_PDB_END);
  282.  
  283.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  284.     has_alpha = return_vals[1].data.d_int32;
  285.  
  286.   gimp_destroy_params (return_vals, nreturn_vals);
  287.  
  288.   return has_alpha;
  289. }
  290.  
  291. /**
  292.  * gimp_drawable_type_with_alpha:
  293.  * @drawable_ID: The drawable.
  294.  *
  295.  * Returns the drawable's type with alpha.
  296.  *
  297.  * This procedure returns the drawable's type if an alpha channel were
  298.  * added. If the type is currently Gray, for instance, the returned
  299.  * type would be GrayA. If the drawable already has an alpha channel,
  300.  * the drawable's type is simply returned.
  301.  *
  302.  * Returns: The drawable's type with alpha.
  303.  */
  304. GimpImageType
  305. gimp_drawable_type_with_alpha (gint32 drawable_ID)
  306. {
  307.   GimpParam *return_vals;
  308.   gint nreturn_vals;
  309.   GimpImageType type_with_alpha = 0;
  310.  
  311.   return_vals = gimp_run_procedure ("gimp_drawable_type_with_alpha",
  312.                     &nreturn_vals,
  313.                     GIMP_PDB_DRAWABLE, drawable_ID,
  314.                     GIMP_PDB_END);
  315.  
  316.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  317.     type_with_alpha = return_vals[1].data.d_int32;
  318.  
  319.   gimp_destroy_params (return_vals, nreturn_vals);
  320.  
  321.   return type_with_alpha;
  322. }
  323.  
  324. /**
  325.  * gimp_drawable_is_rgb:
  326.  * @drawable_ID: The drawable.
  327.  *
  328.  * Returns whether the drawable is an RGB type.
  329.  *
  330.  * This procedure returns non-zero if the specified drawable is of type
  331.  * { RGB, RGBA }.
  332.  *
  333.  * Returns: non-zero if the drawable is an RGB type.
  334.  */
  335. gboolean
  336. gimp_drawable_is_rgb (gint32 drawable_ID)
  337. {
  338.   GimpParam *return_vals;
  339.   gint nreturn_vals;
  340.   gboolean color = FALSE;
  341.  
  342.   return_vals = gimp_run_procedure ("gimp_drawable_is_rgb",
  343.                     &nreturn_vals,
  344.                     GIMP_PDB_DRAWABLE, drawable_ID,
  345.                     GIMP_PDB_END);
  346.  
  347.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  348.     color = return_vals[1].data.d_int32;
  349.  
  350.   gimp_destroy_params (return_vals, nreturn_vals);
  351.  
  352.   return color;
  353. }
  354.  
  355. /**
  356.  * gimp_drawable_is_gray:
  357.  * @drawable_ID: The drawable.
  358.  *
  359.  * Returns whether the drawable is a grayscale type.
  360.  *
  361.  * This procedure returns non-zero if the specified drawable is of type
  362.  * { Gray, GrayA }.
  363.  *
  364.  * Returns: non-zero if the drawable is a grayscale type.
  365.  */
  366. gboolean
  367. gimp_drawable_is_gray (gint32 drawable_ID)
  368. {
  369.   GimpParam *return_vals;
  370.   gint nreturn_vals;
  371.   gboolean gray = FALSE;
  372.  
  373.   return_vals = gimp_run_procedure ("gimp_drawable_is_gray",
  374.                     &nreturn_vals,
  375.                     GIMP_PDB_DRAWABLE, drawable_ID,
  376.                     GIMP_PDB_END);
  377.  
  378.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  379.     gray = return_vals[1].data.d_int32;
  380.  
  381.   gimp_destroy_params (return_vals, nreturn_vals);
  382.  
  383.   return gray;
  384. }
  385.  
  386. /**
  387.  * gimp_drawable_is_indexed:
  388.  * @drawable_ID: The drawable.
  389.  *
  390.  * Returns whether the drawable is an indexed type.
  391.  *
  392.  * This procedure returns non-zero if the specified drawable is of type
  393.  * { Indexed, IndexedA }.
  394.  *
  395.  * Returns: non-zero if the drawable is an indexed type.
  396.  */
  397. gboolean
  398. gimp_drawable_is_indexed (gint32 drawable_ID)
  399. {
  400.   GimpParam *return_vals;
  401.   gint nreturn_vals;
  402.   gboolean indexed = FALSE;
  403.  
  404.   return_vals = gimp_run_procedure ("gimp_drawable_is_indexed",
  405.                     &nreturn_vals,
  406.                     GIMP_PDB_DRAWABLE, drawable_ID,
  407.                     GIMP_PDB_END);
  408.  
  409.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  410.     indexed = return_vals[1].data.d_int32;
  411.  
  412.   gimp_destroy_params (return_vals, nreturn_vals);
  413.  
  414.   return indexed;
  415. }
  416.  
  417. /**
  418.  * gimp_drawable_bytes:
  419.  * @drawable_ID: The drawable.
  420.  *
  421.  * Returns the bytes per pixel.
  422.  *
  423.  * This procedure returns the number of bytes per pixel (or the number
  424.  * of channels) for the specified drawable.
  425.  *
  426.  * Returns: Bytes per pixel.
  427.  */
  428. gint
  429. gimp_drawable_bytes (gint32 drawable_ID)
  430. {
  431.   GimpParam *return_vals;
  432.   gint nreturn_vals;
  433.   gint bytes = 0;
  434.  
  435.   return_vals = gimp_run_procedure ("gimp_drawable_bytes",
  436.                     &nreturn_vals,
  437.                     GIMP_PDB_DRAWABLE, drawable_ID,
  438.                     GIMP_PDB_END);
  439.  
  440.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  441.     bytes = return_vals[1].data.d_int32;
  442.  
  443.   gimp_destroy_params (return_vals, nreturn_vals);
  444.  
  445.   return bytes;
  446. }
  447.  
  448. /**
  449.  * gimp_drawable_width:
  450.  * @drawable_ID: The drawable.
  451.  *
  452.  * Returns the width of the drawable.
  453.  *
  454.  * This procedure returns the specified drawable's width in pixels.
  455.  *
  456.  * Returns: Width of drawable.
  457.  */
  458. gint
  459. gimp_drawable_width (gint32 drawable_ID)
  460. {
  461.   GimpParam *return_vals;
  462.   gint nreturn_vals;
  463.   gint width = 0;
  464.  
  465.   return_vals = gimp_run_procedure ("gimp_drawable_width",
  466.                     &nreturn_vals,
  467.                     GIMP_PDB_DRAWABLE, drawable_ID,
  468.                     GIMP_PDB_END);
  469.  
  470.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  471.     width = return_vals[1].data.d_int32;
  472.  
  473.   gimp_destroy_params (return_vals, nreturn_vals);
  474.  
  475.   return width;
  476. }
  477.  
  478. /**
  479.  * gimp_drawable_height:
  480.  * @drawable_ID: The drawable.
  481.  *
  482.  * Returns the height of the drawable.
  483.  *
  484.  * This procedure returns the specified drawable's height in pixels.
  485.  *
  486.  * Returns: Height of drawable.
  487.  */
  488. gint
  489. gimp_drawable_height (gint32 drawable_ID)
  490. {
  491.   GimpParam *return_vals;
  492.   gint nreturn_vals;
  493.   gint height = 0;
  494.  
  495.   return_vals = gimp_run_procedure ("gimp_drawable_height",
  496.                     &nreturn_vals,
  497.                     GIMP_PDB_DRAWABLE, drawable_ID,
  498.                     GIMP_PDB_END);
  499.  
  500.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  501.     height = return_vals[1].data.d_int32;
  502.  
  503.   gimp_destroy_params (return_vals, nreturn_vals);
  504.  
  505.   return height;
  506. }
  507.  
  508. /**
  509.  * gimp_drawable_offsets:
  510.  * @drawable_ID: The drawable.
  511.  * @offset_x: x offset of drawable.
  512.  * @offset_y: y offset of drawable.
  513.  *
  514.  * Returns the offsets for the drawable.
  515.  *
  516.  * This procedure returns the specified drawable's offsets. This only
  517.  * makes sense if the drawable is a layer since channels are anchored.
  518.  * The offsets of a channel will be returned as 0.
  519.  *
  520.  * Returns: TRUE on success.
  521.  */
  522. gboolean
  523. gimp_drawable_offsets (gint32  drawable_ID,
  524.                gint   *offset_x,
  525.                gint   *offset_y)
  526. {
  527.   GimpParam *return_vals;
  528.   gint nreturn_vals;
  529.   gboolean success = TRUE;
  530.  
  531.   return_vals = gimp_run_procedure ("gimp_drawable_offsets",
  532.                     &nreturn_vals,
  533.                     GIMP_PDB_DRAWABLE, drawable_ID,
  534.                     GIMP_PDB_END);
  535.  
  536.   *offset_x = 0;
  537.   *offset_y = 0;
  538.  
  539.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  540.  
  541.   if (success)
  542.     {
  543.       *offset_x = return_vals[1].data.d_int32;
  544.       *offset_y = return_vals[2].data.d_int32;
  545.     }
  546.  
  547.   gimp_destroy_params (return_vals, nreturn_vals);
  548.  
  549.   return success;
  550. }
  551.  
  552. /**
  553.  * gimp_drawable_is_layer:
  554.  * @drawable_ID: The drawable.
  555.  *
  556.  * Returns whether the drawable is a layer.
  557.  *
  558.  * This procedure returns non-zero if the specified drawable is a
  559.  * layer.
  560.  *
  561.  * Returns: Non-zero if the drawable is a layer.
  562.  */
  563. gboolean
  564. gimp_drawable_is_layer (gint32 drawable_ID)
  565. {
  566.   GimpParam *return_vals;
  567.   gint nreturn_vals;
  568.   gboolean layer = FALSE;
  569.  
  570.   return_vals = gimp_run_procedure ("gimp_drawable_is_layer",
  571.                     &nreturn_vals,
  572.                     GIMP_PDB_DRAWABLE, drawable_ID,
  573.                     GIMP_PDB_END);
  574.  
  575.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  576.     layer = return_vals[1].data.d_int32;
  577.  
  578.   gimp_destroy_params (return_vals, nreturn_vals);
  579.  
  580.   return layer;
  581. }
  582.  
  583. /**
  584.  * gimp_drawable_is_layer_mask:
  585.  * @drawable_ID: The drawable.
  586.  *
  587.  * Returns whether the drawable is a layer mask.
  588.  *
  589.  * This procedure returns non-zero if the specified drawable is a layer
  590.  * mask.
  591.  *
  592.  * Returns: Non-zero if the drawable is a layer mask.
  593.  */
  594. gboolean
  595. gimp_drawable_is_layer_mask (gint32 drawable_ID)
  596. {
  597.   GimpParam *return_vals;
  598.   gint nreturn_vals;
  599.   gboolean layer_mask = FALSE;
  600.  
  601.   return_vals = gimp_run_procedure ("gimp_drawable_is_layer_mask",
  602.                     &nreturn_vals,
  603.                     GIMP_PDB_DRAWABLE, drawable_ID,
  604.                     GIMP_PDB_END);
  605.  
  606.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  607.     layer_mask = return_vals[1].data.d_int32;
  608.  
  609.   gimp_destroy_params (return_vals, nreturn_vals);
  610.  
  611.   return layer_mask;
  612. }
  613.  
  614. /**
  615.  * gimp_drawable_is_channel:
  616.  * @drawable_ID: The drawable.
  617.  *
  618.  * Returns whether the drawable is a channel.
  619.  *
  620.  * This procedure returns non-zero if the specified drawable is a
  621.  * channel.
  622.  *
  623.  * Returns: Non-zero if the drawable is a channel.
  624.  */
  625. gboolean
  626. gimp_drawable_is_channel (gint32 drawable_ID)
  627. {
  628.   GimpParam *return_vals;
  629.   gint nreturn_vals;
  630.   gboolean channel = FALSE;
  631.  
  632.   return_vals = gimp_run_procedure ("gimp_drawable_is_channel",
  633.                     &nreturn_vals,
  634.                     GIMP_PDB_DRAWABLE, drawable_ID,
  635.                     GIMP_PDB_END);
  636.  
  637.   if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
  638.     channel = return_vals[1].data.d_int32;
  639.  
  640.   gimp_destroy_params (return_vals, nreturn_vals);
  641.  
  642.   return channel;
  643. }
  644.  
  645. /**
  646.  * _gimp_drawable_thumbnail:
  647.  * @drawable_ID: The drawable.
  648.  * @width: The thumbnail width.
  649.  * @height: The thumbnail height.
  650.  * @ret_width: The previews width.
  651.  * @ret_height: The previews height.
  652.  * @bpp: The previews bpp.
  653.  * @thumbnail_data_count: The number of pixels in thumbnail data.
  654.  * @thumbnail_data: The thumbnail data.
  655.  *
  656.  * Get a thumbnail of a drawable.
  657.  *
  658.  * This function gets data from which a thumbnail of a drawable preview
  659.  * can be created. Maximum x or y dimension is 128 pixels. The pixels
  660.  * are returned in the RGB[A] format. The bpp return value gives the
  661.  * number of bytes in the image. The alpha channel also returned if the
  662.  * drawable has one.
  663.  *
  664.  * Returns: TRUE on success.
  665.  */
  666. gboolean
  667. _gimp_drawable_thumbnail (gint32   drawable_ID,
  668.               gint     width,
  669.               gint     height,
  670.               gint    *ret_width,
  671.               gint    *ret_height,
  672.               gint    *bpp,
  673.               gint    *thumbnail_data_count,
  674.               guint8 **thumbnail_data)
  675. {
  676.   GimpParam *return_vals;
  677.   gint nreturn_vals;
  678.   gboolean success = TRUE;
  679.  
  680.   return_vals = gimp_run_procedure ("gimp_drawable_thumbnail",
  681.                     &nreturn_vals,
  682.                     GIMP_PDB_DRAWABLE, drawable_ID,
  683.                     GIMP_PDB_INT32, width,
  684.                     GIMP_PDB_INT32, height,
  685.                     GIMP_PDB_END);
  686.  
  687.   *ret_width = 0;
  688.   *ret_height = 0;
  689.   *bpp = 0;
  690.   *thumbnail_data_count = 0;
  691.   *thumbnail_data = NULL;
  692.  
  693.   success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
  694.  
  695.   if (success)
  696.     {
  697.       *ret_width = return_vals[1].data.d_int32;
  698.       *ret_height = return_vals[2].data.d_int32;
  699.       *bpp = return_vals[3].data.d_int32;
  700.       *thumbnail_data_count = return_vals[4].data.d_int32;
  701.       *thumbnail_data = g_new (guint8, *thumbnail_data_count);
  702.       memcpy (*thumbnail_data, return_vals[5].data.d_int8array,
  703.           *thumbnail_data_count * sizeof (guint8));
  704.     }
  705.  
  706.   gimp_destroy_params (return_vals, nreturn_vals);
  707.  
  708.   return success;
  709. }
  710.